/*
 * @Author: mikey.zhaopeng 
 * @Date: 2018-12-18 22:35:43 
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2018-12-19 22:03:29
 */
import 'package:flutter/material.dart';
import './gradient_tag.dart' show GradientTag;

class AppDrawer extends StatelessWidget {
  final Map profile;
  AppDrawer({Key key, this.profile}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Drawer(
      child: Container(
        width: 200.0,
        child: Column(
          children: <Widget>[
            UserAccountsDrawerHeader(
              decoration: BoxDecoration(
                  image: DecorationImage(
                      fit: BoxFit.cover,
                      image: AssetImage("assets/images/drawer_bg.jpeg"))),
              currentAccountPicture: CircleAvatar(
                backgroundImage: NetworkImage(profile['userpic'] ??
                    "http://popeyelau.qiniudn.com/popeye.png"),
              ),
              accountEmail: Text(profile['email'] ?? "bocaijs@126.com"),
              accountName: Row(
                children: <Widget>[
                  Text(profile['nickname'] ?? "Bocai"),
                  SizedBox(
                    width: 8.0,
                  ),
                  GradientTag(
                    title: profile['group_name']??"至尊会员",
                    gradient: LinearGradient(colors: [Colors.orange,Colors.red]),  
                  )
                ],
              ),
            ),
            ListTile(
              onTap: ()=>Navigator.of(context).pop(),
              leading: Icon(
                Icons.star,
                color:Colors.redAccent
              ),
              title: Text("我的收藏"),
            ),
            ListTile(
              onTap: ()=>Navigator.of(context).pop(),
              leading: Icon(
                Icons.comment,
                color:Colors.orangeAccent
              ),
              title: Text("我的评论"),
            ),
            ListTile(
              onTap: (){
                // Navigator.of(context).push(MaterialPageRoute(builder: (context)=>SettingsPage()));
              },
              leading: Icon(
                Icons.settings,
                color:Colors.grey
              ),
              title: Text("设置"),
            ),
            ListTile(
              onTap: ()=>Navigator.of(context).pop(),
              leading: Icon(
                Icons.help,
                color: Colors.orange,
              ),
              title: Text("帮助"),
            )
          ],
        ),
      ),
    );
  }
}
